package no1318;

class Solution {
    public int minFlips(int a, int b, int c) {
        int cLast ,aLast ,bLast;
        int count = 0;
        while (Math.max(a,Math.max(b,c))>0){
            if (a != 1)
                aLast = a%2;
            else
                aLast = 1;
            if (b != 1)
                bLast = b%2;
            else
                bLast = 1;
            cLast = c%2;
            if (cLast == 1){
                if (aLast == 0 && bLast == 0){
                    count++;
                }
            }else {
                if (aLast == 1){
                    count++;
                }
                if (bLast == 1){
                    count++;
                }
            }
            if (b == 1)
                b = 0;
            if (a == 1)
                a = 0;
            if (c == 1)
                c =0;
            a /=2;
            b /=2;
            c /=2;

        }

        return count;
    }
}
